package common

import "fmt"

const Layout = "2006-01-02 15:04:05"

const (
	OrderDesc = "DESC"
	OrderAsc  = "ASC"
)

const (
	BaiDuMap  = "baidu"  // 百度地图
	TianDiMap = "tiandi" // 天地图
	BoxMap    = "box"    // BOX地图
)

// 卡号CN
const (
	CardHead  = "车头"
	CardDrive = "驱动"
	CardHang  = "挂车"
)

// 轮位CN
const (
	SnGuideRight     = "导向轮右前轮胎"
	SnGuideLeft      = "导向轮左前轮胎"
	SnFrontRightOut  = "前桥右外轮胎"
	SnFrontRightIn   = "前桥右内轮胎"
	SnFrontLeftIn    = "前桥左内轮胎"
	SnFrontLeftOut   = "前桥左外轮胎"
	SnCentreRightOut = "中桥右外轮胎"
	SnCentreRightIn  = "中桥右内轮胎"
	SnCentreLeftIn   = "中桥左内轮胎"
	SnCentreLeftOut  = "中桥左外轮胎"
	SnAfterRightOut  = "后桥右外轮胎"
	SnAfterRightIn   = "后桥右内轮胎"
	SnAfterLeftIn    = "后桥左内轮胎"
	SnAfterLeftOut   = "后桥左外轮胎"
)

// GetVolProportion 获取电量百分率:0 ~ 100整数值
func GetVolProportion(vol float64) int {
	if (vol - 3.4) > 0 {
		return int((vol - 3.4) / 0.8 * 100)
	}

	return 0
}

// GetVolPercentileValue 获取电量百分比: 0% ~ 100%
func GetVolPercentileValue(vol float64) string {
	return fmt.Sprintf("%d%%", GetVolProportion(vol))
}
